﻿using AutoMapper;
using MediatR;
using ProcurementManagement.Applcation.Command.QualityCommand;
using ProcurementManagement.Domain.ProcurementDomain;
using ProcurementManagement.Infrstructre.Interface;

namespace ProcurementManagement.Applcation.CommandHanlers.QualityCommandHandler
{
    /// <summary>
    /// 修改
    /// </summary>
    public class UptProPcApplyCommandHandlers:IRequestHandler<UptProApplyCommand, int>
    {
        private readonly IProPcApplyRepository pcApplyRepository;
        IMapper mapper;


        public UptProPcApplyCommandHandlers(IProPcApplyRepository pcApplyRepository, IMapper mapper)
        {
            this.pcApplyRepository = pcApplyRepository;
            this.mapper = mapper;
        }

        public async Task<int> Handle(UptProApplyCommand request, CancellationToken cancellationToken)
        {
            return await pcApplyRepository.UpdataAsync(mapper.Map<ProPcApply>(request.UptDTO));
        }
    }
}
